package tsing.javase.designpattern.stratege.vipstrategy.configure;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


import org.tsing.javase.designpattern.stratege.vipstrategy.strategy.GiveVipStrategy;

import tsing.javase.designpattern.stratege.vipstrategy.context.GiveVipStrategyMap;
import tsing.javase.designpattern.stratege.vipstrategy.strategy.impl.BaiduHandle;
import tsing.javase.designpattern.stratege.vipstrategy.strategy.impl.TenxentHandle;

import java.util.HashMap;
import java.util.Map;

/**
 * @Date 2023/10/24 16:53
 */
@Configuration
public class GiveVipStrategyConfig {

    @Autowired
    private BaiduHandle baiduHandle;

    @Autowired
    private TenxentHandle tenxentHandle;


    @Bean
    public GiveVipStrategyMap getStrategyMethod(){

        GiveVipStrategyMap giveVipStrategyMap = new GiveVipStrategyMap();

        // 创建一个map 集合
        Map<Integer, GiveVipStrategy> map = new HashMap<>();
        // 类型0 ：百度充值
        map.put(0,baiduHandle);
        // 类型1：腾讯充值
        map.put(1,tenxentHandle);
        giveVipStrategyMap.setStrategyMap(map);
        return giveVipStrategyMap;
    }


}
